home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / Mail / temp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-08  |  2.0 KB  |  74 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  */
  17.  
  18. #ifndef lint
  19. static char sccsid[] = "%W% (Berkeley) %G%";
  20. #endif /* not lint */
  21.  
  22. #include "rcv.h"
  23.  
  24. /*
  25.  * Mail -- a mail program
  26.  *
  27.  * Give names to all the temporary files that we will need.
  28.  */
  29.  
  30. char    tempMail[24];
  31. char    tempQuit[24];
  32. char    tempEdit[24];
  33. char    tempSet[24];
  34. char    tempResid[24];
  35. char    tempMesg[24];
  36.  
  37. tinit()
  38. {
  39.     register char *cp;
  40.  
  41.     mktemp(strcpy(tempMail, "/usr/tmp/RsXXXXXX"));
  42.     mktemp(strcpy(tempResid, "/usr/tmp/RqXXXXXX"));
  43.     mktemp(strcpy(tempQuit, "/usr/tmp/RmXXXXXX"));
  44.     mktemp(strcpy(tempEdit, "/usr/tmp/ReXXXXXX"));
  45.     mktemp(strcpy(tempSet, "/usr/tmp/RxXXXXXX"));
  46.     mktemp(strcpy(tempMesg, "/usr/tmp/RxXXXXXX"));
  47.  
  48.     /*
  49.      * It's okay to call savestr in here because main will
  50.      * do a spreserve() after us.
  51.      */
  52.     if (myname != NOSTR) {
  53.         if (getuserid(myname) < 0) {
  54.             printf("\"%s\" is not a user of this system\n",
  55.                 myname);
  56.             exit(1);
  57.         }
  58.     } else {
  59.         if ((cp = username()) == NOSTR) {
  60.             myname = "ubluit";
  61.             if (rcvmode) {
  62.                 printf("Who are you!?\n");
  63.                 exit(1);
  64.             }
  65.         } else
  66.             myname = savestr(cp);
  67.     }
  68.     if ((cp = getenv("HOME")) == NOSTR)
  69.         cp = ".";
  70.     homedir = savestr(cp);
  71.     if (debug)
  72.         printf("user = %s, homedir = %s\n", myname, homedir);
  73. }
  74.